package com.it.taobao.controller;

import com.it.taobao.vo.Product;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: liminghui
 * @date: 2022/6/26 15:24
 * @version: 1.0
 * @description:
 */
@Controller
public class EchartsTest {

    @GetMapping(value = "/echarts")
    public String FirtstEchartsTest(Model model) {
        //test为在为你的html文件名字,SpringBoot会自动找到这个html文件
        String skirt = "裙子";
        int nums = 30;

        model.addAttribute("skirt", skirt);
        model.addAttribute("nums", nums);
        return "test";
    }

    @RequestMapping("/project")
    @ResponseBody
    public List<Product> myProject() {
        ArrayList<Product> productArrayList = new ArrayList<Product>();
        Product product1 = new Product();
        product1.setProductName("袜子");
        product1.setNums(15);
        Product product2 = new Product();
        product2.setProductName("羊毛衫");
        product2.setNums(20);
        Product product3 = new Product();
        product3.setProductName("雪纺衫");
        product3.setNums(24);
        Product product4 = new Product();
        product4.setProductName("高跟鞋");
        product4.setNums(30);

        productArrayList.add(product1);
        productArrayList.add(product2);
        productArrayList.add(product3);
        productArrayList.add(product4);

        return productArrayList;
    }

    @RequestMapping("/index")
    public String index() {
        return "index";
    }

    @RequestMapping("/index1")
    public String index1() {
        return "index1";
    }

    @RequestMapping("/index2")
    public String index2() {
        return "index2";
    }

    @RequestMapping("/index3")
    public String index3() {
        return "index3";
    }

    @RequestMapping("/index4")
    public String index4() {
        return "index4";
    }


}

